package com.zed.api.common.resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.URL;
import java.util.HashMap;
import java.util.Map;

/**
 * 基于模块内的Spring资源提取支持类
 *
 * @author Zed
 */
public abstract class SpringResourcesExtractorWithModuleSupport {

    private static Logger LOGGER = LoggerFactory.getLogger(SpringResourcesExtractorWithModuleSupport.class);

    protected Map<String, URL> location;

    public SpringResourcesExtractorWithModuleSupport(Class<?> targetClass) {
        this.location = new HashMap<>();
        SpringResourcesExtractorWithModule extractorWithModule = new SpringResourcesExtractorWithModule(targetClass);
        extractorWithModule.extract(((path, resource) -> {
            this.location.put(path, resource);
        }));
    }

}
